package com.sk.sourcecircle.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.sourcecircle.R;
import com.sk.sourcecircle.entity.SearchListBean;

import java.util.List;

/**
 * Created by sk on 2017/12/12.
 */

public class SearchAdapter extends BaseQuickAdapter<SearchListBean.DataBean, BaseViewHolder> {
    public SearchAdapter(int layoutResId, @Nullable List<SearchListBean.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchListBean.DataBean item) {
        Glide.with(mContext).load(item.getHead_url()).into((ImageView) helper.getView(R.id.item_bg));
        helper.setText(R.id.tv_name, item.getName())
                .setText(R.id.tv_location, item.getAddress())
                .setText(R.id.tv_time, item.getStart_name() + "开始");
        if(Double.parseDouble(item.getMin_price())>0){

            helper.setText(R.id.tv_price,"￥"+item.getMin_price()).setTextColor(R.id.tv_price, Color.parseColor("#ff5050"));

        }else {
            helper.setText(R.id.tv_price,"免费").setTextColor(R.id.tv_price, Color.parseColor("#219021"));

        }
    }
}
